|
|
|
|
|
|
|
WillChangeRecord event is triggered. Besides the adStatus parameter, this event contains the parameter adReason that tells you which method invoked this event. By checking the adReason parameter, you can perform different processes depending on the type of action taken against the Data control. Table 10.2 lists the values of the adReason parameter. |
|
|
|
|
| TABLE 10.2. THEadReasonPARAMETER VALUES FOR THEWillChangeRecordEVENT. | | Constant | Value | Description | | adRsnAddNew | 1 | AddNew | | adRsnDelete | 2 | Delete | | adRsnUpdate | 3 | Update | | adRsnUndoUpdate | 4 | Undo the Update | | adRsnUndoAddNew | 5 | Undo the AddNew | | adRsnUndoDelete | 6 | Undo the Delete | | adRsnRequery | 7 | Requery the database | | adRsnReSync | 8 | Resync the query with the database | | adRsnClose | 9 | The Close method of the Data control was used | | adRsnMove | 10 | Move | | adRsnFirstChange | 11 | FirstChange | | adRsnMoveFirst | 12 | MoveFirst | | adRsnMoveNext | 13 | MoveNext | | adRsnMovePrevious | 13 | MovePrevious | | adRsnMoveLast | 15 | MoveLast |
|
|
|
|
|
|
The code you place in these events can be as complex as you need. An example WillChangeField rountine is as follows: |
|
|
|
|
|
|
|
|
Private Sub log_db_Validate(cFields As ??, Fields As ??, asStatus As ??, pRecordset As ??)
If Not IsDate(txtDate.Text) Then
MsgBox The Flight date you entered is Invalid & _
vbCRLF & Please Re-enter!, vbCritical, App.Title
Action = vbDataActionCancel
txtDate.DataChanged = False
txtDate.Text = ??/??/??
End If
End If
End Sub |
|
|
|
|
|